import request from '@/utils/request'

// 登录
export const login = ({ username, password }) => {
  return request.post('/api/login', {
    username,
    password
  })
}

// 注册
export const register = ({ username, password, repassword }) => {
  return request.post('/api/reg', {
    username,
    password,
    repassword
  })
}

// 获取用户基本资料
export const getUserinfo = obj => {
  return request.get('/my/userinfo', obj)
}

// 更新用户基本资料
export const updateUserinfo = obj => {
  return request.put('/my/userinfo', obj)
}

// 更新用户头像
export const updateAvatar = obj => {
  return request.patch('/my/update/avatar', obj)
}

// 更新用户密码
export const updatePwd = obj => {
  return request.patch('/my/updatepwd', obj)
}

// 获取侧边栏数据
export const getMenus = obj => {
  return request.get('/my/menus', obj)
}
